package com.yanfan.energy.service;


import com.yanfan.energy.domain.statist.DateStatistics;
import com.yanfan.energy.domain.statist.RangeStatistics;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

/**
 * 能耗总分析模块接口
 *
 * @author caijinkang
 * @since 2022-09-26 13:57:15
 */
public interface TotalEnergyService {

    /**
     * 车间总费用
     *
     * @param workshopId 车间编号
     * @param floorId    楼层编号
     * @param buildingId 楼栋编号
     * @param begin      开始时间
     * @param end        结束时间
     * @param unit       单位
     * @param range      标识
     * @return java.util.Map<java.lang.String, java.util.List < io.github.jhipster.sample.sansheng.tool.statistics.DateStatistics>>
     * @author caijinkang
     * @date 2022/9/26 15:07
     */
    Map<String, Map<String, List<DateStatistics>>> findTotalCost(Long workshopId, Integer floorId, Integer buildingId, String range, LocalDate begin, LocalDate end, Integer unit);

    /**
     * 能源介质总费用
     *
     * @param workshopId
     * @param floorId
     * @param buildingId
     * @param range
     * @param begin
     * @param end
     * @param unit
     * @return java.util.Map<java.lang.String, java.util.List < com.ruoyi.common.core.domain.model.DateStatistics>>
     * @author caijinkang
     * @date 2023/5/5 11:58
     */
    Map<String, List<DateStatistics>> findTotalMedium(Integer workshopId, Integer floorId, Integer buildingId, String range, LocalDate begin, LocalDate end, Integer unit);

    /**
     * 查询时间范围的统计
     *
     * @param dates
     * @param statistics
     * @return java.util.List<io.github.jhipster.sample.sansheng.tool.statistics.DateStatistics>
     * @author caijinkang
     * @date 2022/9/27 15:12
     */
    List<DateStatistics> findDateStatistics(List<String> dates, List<DateStatistics> statistics);

    /**
     * 单价计算
     *
     * @param dateStatistics
     * @param unit
     * @param type
     * @return java.util.List<io.github.jhipster.sample.sansheng.tool.statistics.DateStatistics>
     * @author caijinkang
     * @date 2022/9/28 17:03
     */
    List<DateStatistics> findPriceStatistics(List<DateStatistics> dateStatistics, Integer unit, Integer type);

    /**
     * 单价计算
     *
     * @param dateStatistics
     * @param unit
     * @param type
     * @return java.util.List<io.github.jhipster.sample.sansheng.tool.statistics.DateStatistics>
     * @author caijinkang
     * @date 2022/9/28 17:03
     */
    DateStatistics findPriceStatistic(DateStatistics dateStatistics, Integer unit, Integer type);

    /**
     * 统计车间各个能耗
     *
     * @param statistics
     * @return java.util.Map<java.lang.String, java.util.List < io.github.jhipster.sample.sansheng.tool.statistics.DateStatistics>>
     * @author caijinkang
     * @date 2022/9/29 13:26
     */
    Map<String, List<DateStatistics>> findAllEnergy(Map<String, List<DateStatistics>> statistics);

    /**
     * 统计车间各个能耗不同时间
     *
     * @param dates
     * @param statistics
     * @param range
     * @return java.util.Map<java.lang.String, java.util.List < io.github.jhipster.sample.sansheng.tool.statistics.DateStatistics>>
     * @author caijinkang
     * @date 2022/9/29 13:26
     */
    Map<String, List<DateStatistics>> findAllEnergyTwo(List<String> dates, Map<String, List<DateStatistics>> statistics, String range);

    /**
     * 把字符串时间排序
     *
     * @param dateStatistics
     * @param range
     * @return java.util.List<com.ruoyi.common.core.domain.model.DateStatistics>
     * @author caijinkang
     * @date 2022/12/6 14:47
     */
    List<DateStatistics> findSortDate(List<DateStatistics> dateStatistics, String range);

    /**
     * 统计设备系统各个能耗
     *
     * @param statistics
     * @return java.util.Map<java.lang.String, java.util.List < io.github.jhipster.sample.sansheng.tool.statistics.DateStatistics>>
     * @author caijinkang
     * @date 2022/9/29 13:26
     */
    Map<String, List<DateStatistics>> findAllSystemEnergy(Map<String, List<DateStatistics>> statistics);

    /**
     * 统计各个车间的所有能耗
     *
     * @param statistics
     * @param range
     * @return java.util.Map<java.lang.String, java.util.List < io.github.jhipster.sample.sansheng.tool.statistics.DateStatistics>>
     * @author caijinkang
     * @date 2022/10/8 10:20
     */
    Map<String, List<DateStatistics>> findWorkshopEnergy(Map<String, List<DateStatistics>> statistics, String range);

    /**
     * 统计各个车间的所有能耗
     *
     * @param statistics
     * @return java.util.Map<java.lang.String, java.util.List < io.github.jhipster.sample.sansheng.tool.statistics.DateStatistics>>
     * @author caijinkang
     * @date 2022/10/8 10:20
     */
    Map<String, List<DateStatistics>> findWorkshopProportion(Map<String, List<DateStatistics>> statistics);

    /**
     * 车间总费用占比
     *
     * @param workshopId
     * @param floorId
     * @param buildingId
     * @param range
     * @param begin
     * @param end
     * @param unit
     * @return java.util.Map<java.lang.String, java.util.Map < java.lang.String, java.util.List < com.ruoyi.common.core.domain.model.DateStatistics>>>
     * @author caijinkang
     * @date 2023/6/9 10:12
     */
    Map<String, Map<String, List<DateStatistics>>> findWorkshopCostOf(Long workshopId, Integer floorId, Integer buildingId, String range, LocalDate begin, LocalDate end, Integer unit);

    /**
     * 能源介质总费用占比
     *
     * @param workshopId
     * @param floorId
     * @param buildingId
     * @param range
     * @param begin
     * @param end
     * @param unit
     * @return java.util.Map<java.lang.String, java.util.List < com.ruoyi.common.core.domain.model.DateStatistics>>
     * @author caijinkang
     * @date 2023/6/9 10:12
     */
    Map<String, List<DateStatistics>> findMediumCostOf(Integer workshopId, Integer floorId, Integer buildingId, String range, LocalDate begin, LocalDate end, Integer unit);

    /**
     * 设备总能耗
     *
     * @param workshopId
     * @param range
     * @param begin
     * @param end
     * @param unit
     * @return java.util.Map<java.lang.String, java.util.List < io.github.jhipster.sample.sansheng.tool.statistics.DateStatistics>>
     * @author caijinkang
     * @date 2022/10/8 13:27
     */
    Map<String, List<DateStatistics>> findEquipmentEnergy(Long workshopId, String range, LocalDate begin, LocalDate end, Integer unit);

    /**
     * 车间能源数据
     *
     * @param datetime
     * @param workshopId
     * @param begin
     * @param end
     * @param byType
     * @return java.util.Map<java.lang.String, java.util.List < com.ruoyi.common.core.domain.model.DateStatistics>>
     * @author caijinkang
     * @date 2022/11/30 16:05
     */
    Map<String, List<DateStatistics>> findEnergyByType(String datetime, Long workshopId, LocalDate begin, LocalDate end, Integer byType);

    /**
     * 赋值
     *
     * @param dateStatistics
     * @return java.util.List<io.github.jhipster.sample.sansheng.tool.statistics.DateStatistics>
     * @author caijinkang
     * @date 2022/10/17 22:27
     */
    List<DateStatistics> findSetEnergy(List<DateStatistics> dateStatistics);


    /**
     * 根据range抽离时间
     *
     * @param range
     * @param begin
     * @param end
     * @param format
     * @param datetime
     * @return com.ruoyi.common.core.domain.model.RangeStatistics
     * @author caijinkang
     * @date 2022/11/30 16:05
     */
    RangeStatistics findDateByRange(String range, LocalDate begin, LocalDate end, String format, String datetime);

    /**
     * 能源介质总费用公共车间的计算
     *
     * @param electricList
     * @param compressedAirData
     * @param waterData
     * @param thermalList
     * @param range
     * @param begin
     * @param end
     * @param unit
     * @return java.util.Map<java.lang.String, java.util.List < com.ruoyi.common.core.domain.model.DateStatistics>>
     * @author caijinkang
     * @date 2022/12/1 11:07
     */
    Map<String, List<DateStatistics>> findConjunctByEnergy(List<DateStatistics> electricList, List<DateStatistics> compressedAirData, List<DateStatistics> waterData, List<DateStatistics> thermalList, String range, LocalDate begin, LocalDate end, Integer unit);

    /**
     * 能源介质总费用占比公共车间的计算
     *
     * @param electricList
     * @param compressedAirData
     * @param waterData
     * @param thermalList
     * @param range
     * @param begin
     * @param end
     * @param unit
     * @return java.util.Map<java.lang.String, java.util.List < com.ruoyi.common.core.domain.model.DateStatistics>>
     * @author caijinkang
     * @date 2022/12/2 15:06
     */
    Map<String, List<DateStatistics>> findConjunctByEnergyCount(List<DateStatistics> electricList, List<DateStatistics> compressedAirData, List<DateStatistics> waterData, List<DateStatistics> thermalList, String range, LocalDate begin, LocalDate end, Integer unit);

    /**
     * 查找车间能源监控的饼图的计算
     *
     * @param unit           [0=用量、1=费用]
     * @param type           [1=默认的计算、2=当月的计算]
     * @param dateStatistics 能耗
     * @return java.util.Map<java.lang.String, java.util.List < com.ruoyi.common.core.domain.model.DateStatistics>>
     * @author caijinkang
     * @date 2022/12/1 10:26
     */
    Map<String, List<DateStatistics>> findConjunctByEnergy(Integer unit, Integer type, List<DateStatistics> dateStatistics);

}
